#include "stdafx.h"
#include "AdviceBase.h"
#include "Aspector.h"
#include "EmptyPointcut.h"

int CAdviceBase::priorityCounter = 0;

CAdviceBase::CAdviceBase()
	:pointCut(CEmptyPointcut::Instance()),priority(1000 + priorityCounter++)
{
	CAspector::Instance()->AddAdvice(this);
}

CAdviceBase::CAdviceBase(IPointcut* _pointCut,int _priority)
	:pointCut(_pointCut),priority(_priority + priorityCounter++)
{
	CAspector::Instance()->AddAdvice(this);
}

CAdviceBase::~CAdviceBase()
{
	CAspector::Instance()->RemoveAdvice(this);
}

IPointcut& CAdviceBase::GetPointcut()
{
	return *pointCut;
}

int CAdviceBase::GetPriority()
{
	return priority;
}

